import { MockMethod } from "vite-plugin-mock";
import { resultPageSuccess, resultSuccess } from "../_util";

const GroupList = [
  [
    {
      groupId: 1,
      groupName: "test_b1d586428ca3",
      type: "test_f2a54706375f",
      total: 72,
      stock: 1,
      introduction: "test_22d53bd9c4f8",
    },
    {
      groupId: 2,
      groupName: "test_070032edfe24",
      type: "test_3eb0c3dc63b0",
      total: 85,
      stock: 10,
      introduction: "test_81f9ed91c1c6",
    },
    {
      groupId: 3,
      groupName: "test_81248f9342c9",
      type: "test_0055b702a1bc",
      total: 79,
      stock: 29,
      introduction: "test_422607a52778",
    },
  ],
  [
    {
      groupId: 4,
      groupName: "test_aaa76a5e3670",
      type: "test_e80a87688cf5",
      total: 74,
      stock: 10,
      introduction: "test_40c2db64dadf",
    },
    {
      groupId: 5,
      groupName: "test_49eed634aa9b",
      type: "test_52ae9b6653ff",
      total: 74,
      stock: 62,
      introduction: "test_dea24c5c8412",
    },
  ],
];

const UserList = [
  [
    {
      userId: 10,
      collegeId: 56,
      userCode: "test_e1631e611c9d",
      userName: "test_58c1464cff50",
      collegeName: "test_45c889160e92",
    },
    {
      userId: 71,
      collegeId: 38,
      userCode: "test_b6cac4ab7ba5",
      userName: "test_d0e862ae5b8e",
      collegeName: "test_6d850a1ea1a7",
    },
    {
      userId: 97,
      collegeId: 49,
      userCode: "test_2fab3283530d",
      userName: "test_e3f071f42128",
      collegeName: "test_8f1f73d8b61e",
    },
    {
      userId: 51,
      collegeId: 69,
      userCode: "test_727c432c7172",
      userName: "test_77816403ad40",
      collegeName: "test_3d728b318aa3",
    },
    {
      userId: 7,
      collegeId: 32,
      userCode: "test_58cdfa63ae5d",
      userName: "test_4c9a1c2c06cd",
      collegeName: "test_cc0e7e68cc2b",
    },
  ],
  [
    {
      userId: 62,
      collegeId: 92,
      userCode: "test_3f1ace40d8b7",
      userName: "test_7064b9364d4e",
      collegeName: "test_2850b4dfe244",
    },
    {
      userId: 81,
      collegeId: 62,
      userCode: "test_175210288daa",
      userName: "test_5e8684e803ed",
      collegeName: "test_0132ceedb528",
    },
    {
      userId: 25,
      collegeId: 81,
      userCode: "test_862a24645ae4",
      userName: "test_1c7f7801f008",
      collegeName: "test_c59905e7712c",
    },
    {
      userId: 54,
      collegeId: 66,
      userCode: "test_56b1ccaa2f3f",
      userName: "test_95f444c7406e",
      collegeName: "test_7d1ff019d8e9",
    },
    {
      userId: 15,
      collegeId: 45,
      userCode: "test_8be47e4d3837",
      userName: "test_4a00f4d615c8",
      collegeName: "test_acee67f0d01a",
    },
  ],
];

const SelectList = [
  {
    groupId: 1,
    groupName: "第一实习小组",
  },
  {
    groupId: 2,
    groupName: "第二实习小组",
  },
];

const ApplyList = [
  {
    userId: 2,
    groupId: 94,
    userName: "test_3bed946fd095",
    userCode: "test_e1631ep11c9d",
    groupName: "test_ac663eb5e181",
    collegeName: "test_9bceff91cd8f",
    applyTime: "2016-03-13 21:16:17",
    reason: "test_f0f1a68adc38",
  },
  {
    userId: 34,
    groupId: 43,
    userName: "test_710c9d4a6357",
    userCode: "test_e1631e611c8d",
    groupName: "test_92d9f90e60c8",
    collegeName: "test_31848c254d24",
    applyTime: "2017-01-26 22:59:01",
    reason: "test_3666c128e054",
  },
];

const replyList = [
  {
    groupId: 31,
    groupName: "test_bb7504dc1584",
    type: "test_1e91cc46820e",
    introduction: "test_f018844cc531",
    applyTime: "2031-03-13 12:45:05",
    reason: "test_56283a59f38e",
    total: 80,
  },
];

export default [
  {
    url: "/dev-api/group/page",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, GroupList[0]);
    },
  },
  {
    url: "/dev-api/group/page/:userId",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, GroupList[1]);
    },
  },
  {
    url: "/dev-api/group/list/tutor/:id",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, UserList[1]);
    },
  },
  {
    url: "/dev-api/group/list/captain",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, UserList[0]);
    },
  },
  {
    url: "/dev-api/group/save/default",
    timeout: 100,
    method: "post",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/group/save/practical",
    timeout: 100,
    method: "post",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/group/update",
    timeout: 100,
    method: "put",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/group/remove/:id",
    timeout: 100,
    method: "delete",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/group/bindCaptain/:userId/:groupId",
    timeout: 100,
    method: "post",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/group/dumpCaptain/:userId/:groupId",
    timeout: 100,
    method: "delete",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/group/selectList",
    timeout: 100,
    method: "get",
    response: () => {
      return resultSuccess(SelectList);
    },
  },
  {
    url: "/dev-api/group/applyList",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, ApplyList);
    },
  },
  {
    url: "/dev-api/group/replyList",
    timeout: 100,
    method: "get",
    response: ({ query }) => {
      const { pageNum = 1, pageSize = 10 } = query;
      return resultPageSuccess(pageNum, pageSize, replyList);
    },
  },
  {
    url: "/dev-api/group/apply",
    timeout: 100,
    method: "post",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/group/agree/:userId/:groupId",
    timeout: 100,
    method: "put",
    response: () => {
      return resultSuccess({});
    },
  },
  {
    url: "/dev-api/group/reject/:userId/:groupId",
    timeout: 100,
    method: "delete",
    response: () => {
      return resultSuccess({});
    },
  },
] as MockMethod[];
